package com.zdp.news;

import java.util.Objects;

/**
 * @author zhengdp
 * @Description
 * @Date 2022/11/20 0:49
 * @Created by zhengdp
 */
public class FxNewProvider {

    private IFXNewListener newsListener;
    private IFXNewsPersister newPersistener;

    public void getAndPersistNews() {
        String[] newsIds = newsListener.getAvailableNewsIds();
        if(Objects.isNull(newsIds) || newsIds.length == 0){
            return ;
        }
        for(String newsId : newsIds) {
            FXNewsBean newsBean = newsListener.getNewsByPk(newsId);
            newPersistener.persistNews(newsBean);
            newsListener.postProcessIfNecessary(newsId);
        }

    }


}
